package com.pdemo.core.dao;

import java.util.List;

import javax.persistence.Query;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;

import org.springframework.stereotype.Repository;

import com.pdemo.core.entity.SystemRole;
import com.pdemo.core.genericdao.GenericDao;

@Repository("roleDao")
public class RoleDao extends GenericDao<SystemRole, Long>{
	
	List<SystemRole> getSystemRoles(){
		CriteriaBuilder cb = entityManager.getCriteriaBuilder();
		CriteriaQuery<SystemRole> cq = cb.createQuery(SystemRole.class);
		cq.from(SystemRole.class);
		Query query = entityManager.createQuery(cq);
		return query.getResultList();
	}
}
